// //解析跳转网页所传参数属性值
// let nee = getUrlParams(location.href)
// console.log(nee);
// let productid = nee.productid
// // console.log(productid);
// fetch("http://chst.vip:1234/api/getproductcom")
// .then((body)=>body.json())
// .then((res)=>{
//     console.log(res);
// })
// $.ajax({URL:`http://chst.vip:1234/api/getproduct?productid=${productid}`})
// .then(res=>{
//     console.log(res);
//     let html = "";
//     let{result:date}=res;
//     date.forEach(item=>{
//         html+=`
//         <li>${item.productName}</li>
//         `
//     })
//     $("#navv").html(html);
// })


(function(){
    let qr = getUrlParams(location.href)
    let categoryid = qr.categoryid;
    let productid = qr.productid; 
    let titletl = qr.title
    console.log(titletl);
    $.ajax({url:`http://chst.vip:1234/api/getproduct?productid=${productid}`})
    .then(res=>{
        // console.log(res);
        let newData = [...res.result]
        let backtl = `<a href="../pages/brand.html">${titletl}&gt;</a>`
        let page = ''
        newData.forEach(item=>{
           let title = item.productName.substr(0,4);
           backtl+=`<a href="">${title}</a>`
            page+= `
            <div class="info">
                <div class="pic">
                    ${item.productImg}
                </div>
                <div class="title">${item.productName}</div>
            </div>
            <div class="makeprice">
                ${item.bjShop}
            </div>
            `
        })
        $('main').prepend(page)
        $('.backup').append(backtl)
    })
    $.ajax({url:`http://chst.vip:1234/api/getproductcom?productid=${productid}`})
    .then(res=>{
        console.log(res);
        let newData = [...res.result]
        let hhtml=''
        newData.forEach(item=>{
            hhtml+=`
            <div class="content clearfix">
                <div class="up clearfix">
                    <span class="id fl">${item.comName}</span>
                    <span class="time fr">${item.comTime}</span>
                </div>
                <div class="content_in">
                    ${item.comContent}
                </div>
                <div class="form fr">
                    <span>${item.comFrom}</span>
                </div>
            </div>
            `  
        })
        $('.comment').append(hhtml)
    })
})()